package com.sd.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

/**
 * 
 * 记录系统存储
 * 
 * @author Alex.Lu
 *
 */
public class PreferencesManager {

	private String PREFS_SYS="system_set";
	
	private SharedPreferences mSPSys;
	private Editor mSDSys;
	public String PREFS_IS_FIRST="is_first";
	public String PREFS_DIR = "sd_dir";
	public String PREFS_USER = "user_sid";
	
	private static PreferencesManager instance;
	
	public static PreferencesManager getInstance(){
		if(instance == null)
			instance = new PreferencesManager();
		return instance;
	}
	
	private PreferencesManager(){
		
	}
	
	public void initPreferences(Context context){
		mSPSys = context.getSharedPreferences(PREFS_SYS, 0); 
		mSDSys = mSPSys.edit();
		
	}
	
	public void setISFirst(boolean first){
		mSDSys.putBoolean(PREFS_SYS, first);
		mSDSys.commit();
	}
	
	public boolean getISFirst(){
		return mSPSys.getBoolean(PREFS_SYS, true);
	}
	
	public void setSDDir(String dir){
		mSDSys.putString(PREFS_DIR, dir);
		mSDSys.commit();
	}
	
	public String getDir(){
		return mSPSys.getString(PREFS_DIR, "");
	}
	
	public void setSid(String sid){
		mSDSys.putString(PREFS_USER, sid);
		mSDSys.commit();
	}
	public String getSid(){
		return mSPSys.getString(PREFS_USER, "");
	}
	
	
	

}
